package com.example.com.daervideo.activitys.users;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.com.daervideo.R;

/**
 * Created by i7-1 on 2018/12/6.
 */

public class CommentActivity extends AppCompatActivity {

    private int mIndex;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_comment);
        initData();
    }

    private void initData() {
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.m_rv);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        Bundle b = getIntent().getBundleExtra("b");
        TextView title = (TextView) findViewById(R.id.toolbar).findViewById(R.id.title);
        if (b != null) {
            mIndex = b.getInt("index");
            switch (mIndex) {
                case 1:
                    title.setText("获得打赏");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
                case 2:
                    title.setText("获得礼物");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
                case 3:
                    title.setText("评论我的");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
                case 4:
                    title.setText("关注我的");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
                case 5:
                    title.setText("回馈消息");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
                case 6:
                    title.setText("社区消息");
                    recyclerView.setAdapter(new CommentAdapter());
                    break;
            }

        }

    }

    private class CommentAdapter extends RecyclerView.Adapter {
        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view;
            switch (mIndex) {
                case 1:
                case 2:
                case 3:
                    view = LayoutInflater.from(CommentActivity.this).inflate(R.layout.item_comment_m, parent, false);
                    break;
                case 4:
                case 5:
                    view = LayoutInflater.from(CommentActivity.this).inflate(R.layout.item_attende_m, parent, false);
                    break;
                case 6:
                    view = LayoutInflater.from(CommentActivity.this).inflate(R.layout.item_social_m, parent, false);
                    break;
                default:
                    view = LayoutInflater.from(CommentActivity.this).inflate(R.layout.item_social_m, parent, false);
            }
            return new MHolder(view);
        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

        }

        @Override
        public int getItemCount() {
            return 0;
        }
    }


    private class MHolder extends RecyclerView.ViewHolder {
        public MHolder(View view) {
            super(view);
        }
    }
}
